# -*- coding: utf-8 -*-
# @Time:2021/04/27 21:48
# @Author:Cindy
from appium.webdriver.common.mobileby import MobileBy
from pages.base_page import BasePage


class EditMemberPage(BasePage):

    def edit_member(self, name, phone):
        from pages.add_member_page import AddMemberPage

        input_name_box = (MobileBy.XPATH, "//*[contains(@text,'姓名')]/..//*[contains(@text,'必填')]")
        input_phone_box = (MobileBy.XPATH, "//*[contains(@text,'手机')]/..//*[contains(@text,'必填')]")
        save_button = (MobileBy.XPATH, "//*[@text='保存']")

        # 输入姓名
        self.find(input_name_box).send_keys(name)
        # 输入手机号
        self.find(input_phone_box).send_keys(phone)
        # 点击[保存]按钮
        self.find(save_button).click()

        return AddMemberPage(self.driver)
